package cc.lucien.jdbcDemo01;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

public class DButilsTest {
    public static void main(String[] args) throws SQLException {
        Connection connection = DButils.getConnection();
        System.out.println(connection);
        String sql = "select * from customer where age >= ?";
        ResultSet resultSet = DButils.executeQuery(sql, 30);
        while (resultSet.next()) {
            System.out.print(resultSet.getObject("id"));
            System.out.print(", " + resultSet.getObject("age"));
            System.out.print(", " + resultSet.getObject("name"));
            System.out.println();
        }

        String sql2 = "insert into customer(id, age, name) values(?, ?, ?)";
        DButils.executeUpdate(sql2, "95", "20", "luLian");
        DButils.close();
    }
}
